package ontology.models.contract;

import java.util.Date;

import jade.content.Concept;

public class Obligation extends AbstractSituation{
	
	public static enum Status{
		FULFILLED,
		PENDING,
		VIOLATED,
		LIVELINE_VIOLATED
	}
	
	private static final long serialVersionUID = 1L;
	private String liveline;
	private String deadline;
	private Status status;
	
	private String norm;
	
	public String getLiveline() {
		return liveline;
	}
	public void setLiveline(String liveline) {
		this.liveline = liveline;
	}
	public String getDeadline() {
		return deadline;
	}
	public void setDeadline(String deadline) {
		this.deadline = deadline;
	}	
	public Status getStatus() {
		return status;
	}
	public void setStatus(Status status) {
		this.status = status;
	}
	
	
	public String getNorm() {
		return norm;
	}
	public void setNorm(String norm) {
		this.norm = norm;
	}
	@Override
	public String toString() {
		String stat;
		switch (status) {
		case PENDING: stat = "pending";
			break;
		case FULFILLED: stat = "fulfilled";
			break;
		case VIOLATED: stat = "violated";
			break;
		case LIVELINE_VIOLATED: stat = "liveline_violated";
		default:
			stat = "pending";
			break;
		}
		Date liveline = new Date(Long.parseLong(this.liveline));
		Date deadline = new Date(Long.parseLong(this.deadline));
		return "\nTicket: "+getAction().getTicker()+"Satus: "+stat+", "+getAction().getSender()+" must "+getAction().getName()+" to "+getAction().getReceiver()+" between ["+liveline.toString()+", "+deadline.toString()+"]";
	}
	
}
